<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>8-01 图形阴影</title>
</head>
<body>
  <canvas id="c" width="600" height="600" style="border: 1px solid #ccc;"></canvas>

  <script>
    const context = document.getElementById('c')
    const ctx = context.getContext('2d')

    ctx.shadowOffsetX = 10 // x轴偏移量
    ctx.shadowOffsetY = 10 // y轴偏移量
    ctx.shadowColor = 'pink' // 阴影颜色
    ctx.shadowBlur = 10 // 阴影模糊度，默认0

    ctx.fillStyle = 'skyblue'
    ctx.fillRect(50, 50, 200, 100)
  </script>
</body>
</html>